package com.fadadianqi.mall.dao.ibatis;

import com.fadadianqi.commons.GenericDAOSuport;
import com.fadadianqi.mall.dao.MemberDAO;
import com.fadadianqi.mall.model.Member;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
public class MemberDAOImpl extends GenericDAOSuport<String, Member> implements
        MemberDAO {

    @Override
    protected Class<?> getObjectClass() {
        return Member.class;
    }

    @Override
    protected String getTableName() {
        return "mall_member";
    }

    @Override
    public Member getByEmail(String email) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("email", email);
        return super.getByPropertys(map);
    }

    @Override
    public Member getByMobile(String mobile) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("mobile", mobile);
        return super.getByPropertys(map);
    }

    @Override
    public Member getByName(String name) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("name", name);
        return super.getByPropertys(map);
    }


}
